<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <p>劳斯莱斯代金券，请输入下面验证码领取</p>
    <div>
        <input type="text">
        <button>确定</button>
       
        <span style="width: 100px;height: 30px;border: 1px solid #000;margin-left: 50px;"> </span>
        
    
    </div>


    <script>
       var inp = document.getElementsByTagName("input")[0];
       var btn = document.getElementsByTagName("button")[0];
       var Ospan = document.getElementsByTagName("span")[0];

              Ospan.innerHTML= parseInt(Math.random()*10000)
         Ospan.onclick = function(){
               Ospan.innerHTML=  parseInt(Math.random()*10000)
         }   
      
      


        btn.onclick=function(){
            var aa=inp.value;
            var bb = Ospan.innerHTML;
            if(aa==bb){
               alert("恭喜你获得劳斯莱斯代金券五元")
            }
            else{
                alert("错了，错了，你是不是冒牌货")
            }
        }



    </script>
</body>
</html>